package cn.tedu.charging.user.controller;

import cn.tedu.charging.common.pojo.JsonResult;
import cn.tedu.charging.user.pojo.vo.UserInfoVO;
import cn.tedu.charging.user.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "用户接口")
@Slf4j
@RequestMapping("user")
@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @ApiOperation("获取用户信息")
    @GetMapping("/info/{userId}")
    public JsonResult<UserInfoVO> getUserInfo(@PathVariable("userId") Integer userId){
        log.debug("获取用户信息:{}",userId);
        UserInfoVO userInfoVO = userService.getUserInfo(userId);
        JsonResult<UserInfoVO> result = JsonResult.ok(userInfoVO,"获取用户信息成功");
        log.debug("获取用户信息:入参:{},结果:{}",userId,result);
        return result;
    }
}
